﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Framework.GraphicsExtension.Element
{
    public class Triangle
    {

        public Triangle(double oneEdge, double twoEdge, double threeEdge)
        {

            OneEdge = oneEdge;
            TwoEdge = twoEdge;
            ThreeEdge = threeEdge;
            IsTriangle();
        }
        /// <summary>
        /// 判断是否有效的三角形
        /// </summary>
        private void IsTriangle()
        {
            if (!IsTriangle(OneEdge, TwoEdge, ThreeEdge))
            {
                throw new Exception("不是有效的三角形");
            }
        }
        /// <summary>
        /// 判断是否有效的三角形
        /// </summary>
        public static bool IsTriangle(double oneEdge, double twoEdge, double threeEdge)
        {
            double maxEdge = oneEdge;
            if (maxEdge < twoEdge)
                maxEdge = twoEdge;
            if (maxEdge < threeEdge)
                maxEdge = threeEdge;
            return (maxEdge < (oneEdge + twoEdge) && maxEdge < (oneEdge + threeEdge) && maxEdge < (twoEdge + threeEdge));
        }
        /// <summary>
        /// 第一个角
        /// </summary>
        public float OneInteriorAngle { get; set; }
        /// <summary>
        /// 第二个角
        /// </summary>
        public float TwoInteriorAngle { get; set; }
        /// <summary>
        /// 第三个角
        /// </summary>
        public float ThreeInteriorAngle { get; set; }
        /// <summary>
        /// 第一个边
        /// </summary>
        public double OneEdge { get; set; }
        /// <summary>
        /// 第二个边
        /// </summary>
        public double TwoEdge { get; set; }
        /// <summary>
        /// 第三个边
        /// </summary>
        public double ThreeEdge { get; set; }
        #region 三角形类型
        /// <summary>
        /// 锐角三角形
        /// </summary>
        public bool IsAcuteAngle { get; set; }
        /// <summary>
        /// 直角三角形
        /// </summary>
        public bool IsRightAngle { get; set; }
        /// <summary>
        /// 钝角三角形
        /// </summary>
        public bool IsObtuseAngle { get; set; }
        /// <summary>
        /// 不等边三角形
        /// </summary>
        public bool IsScalene { get; set; }
        /// <summary>
        /// 等边三角形
        /// </summary>
        public bool IsEquilateral { get; set; }
        /// <summary>
        /// 等腰三角形
        /// </summary>
        public bool IsAnIsosceles { get; set; }
        #endregion


    }
}
